package com.wnhz.work.yz.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.wnhz.work.yz.R;
import com.wnhz.work.yz.bean.PayTBean;

import java.util.List;

/**
 * Created by admin on 2017/1/10.
 */
public class PayTypeAdapter extends BaseAdapter {
    private Context context;
    private List<PayTBean> beanList;
    private String anem;

    public PayTypeAdapter(Context context, List<PayTBean> beanList, String name) {
        this.context = context;
        this.beanList = beanList;
        anem = name;
    }

    @Override
    public int getCount() {
        return beanList.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        PayTypeViewHolder viewHolder = new PayTypeViewHolder();
        if (convertView == null) {
            convertView = LayoutInflater.from(context).inflate(R.layout.paytype_item, null);
            viewHolder.tv_title = (TextView) convertView.findViewById(R.id.tv_title);
            viewHolder.tv_content = (TextView) convertView.findViewById(R.id.tv_content);

            convertView.setTag(viewHolder);
        } else {
            viewHolder = (PayTypeViewHolder) convertView.getTag();
        }


        viewHolder.tv_title.setText(beanList.get(position).getPay_name());
        viewHolder.tv_content.setText(beanList.get(position).getPay_way());
        return convertView;
    }

    class PayTypeViewHolder {
        TextView tv_title;
        TextView tv_content;
    }
}
